package com.example.bishe.web.c.controller;


import com.baomidou.mybatisplus.core.metadata.IPage;
import com.example.bishe.entity.Message;
import com.example.bishe.service.MessageService;
import com.example.bishe.util.RestResult;
import com.example.bishe.web.c.vo.UserApprovalVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author LDH
 * @since 2023/04/02
 */
@RestController
@RequestMapping("/c/message")
@Api(value = "客户端查询", tags = {"用户消息通知"})
public class CMessageController {

    @Autowired
    private MessageService messageService;

    @ApiOperation("用户查询消息通知")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "pageSize", value = "页大小", paramType = "query"),
            @ApiImplicitParam(name = "pageNum", value = "页码", paramType = "query"),
            @ApiImplicitParam(name = "userId", value = "用户id", paramType = "query")
    })
    @GetMapping("/page")
    public RestResult<IPage<Message>> page(
            @RequestParam(required = false,defaultValue = "1")  int pageNum,
            @RequestParam(required = false,defaultValue = "10") int pageSize,
            @RequestParam(required = false) Long userId
    ){
        return RestResult.get_success(messageService.getMessage(pageNum,pageSize,userId));
    }

}
